home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr10
/
boxit010.zip
/
BOXIT.S
< prev
next >
Wrap
Text File
|
1993-06-24
|
9KB
|
225 lines
/*
┌╥─────────────────────────────────────────────────────────────────────╥┐
│║ Macro Title: BoxIt! ║│
│║ Version....: 0.10 for TSE 1.0 Pre-Release ║│
│║ Author.....: George J. De Bruin ║│
│║ Address....: 1414 Shiloh Rd. Apt/Box 511 ║│
│║ Plano, TX 75074 ║│
│║ Phone......: (214) 422-0266 ║│
│║ BBS Contact: Qedit support conferences on the following Mail Nets: ║│
│║ RIME, Ilink, Intelec, Metrolink, FidoNet, EchoNet. ║│
│║ Also available via the Ilink Editor's Conference, and ║│
│║ directly on SemWare's Support BBS. ║│
│╟─────────────────────────────────────────────────────────────────────╢│
│║ This macro is hereby released as freeware. Anyone may use ║│
│║ or modify it in any way they see fit. Future versions may carry ║│
│║ more notices on distributing modified versions of BoxIt! ║│
│╟─────────────────────────────────────────────────────────────────────╢│
│║ R E L E A S E N O T I C E ║│
│║ ║│
│║ This macro is officially released to SemWare for possible ║│
│║ distribution in conjunction with The SemWare Editor, or an ancillary║│
│║ macro collection. ║│
│╟─────────────────────────────────────────────────────────────────────╢│
│║ Purpose: ║│
│║ ║│
│║ This is a simple macro that will draw a box around column blocked ║│
│║ area using TSE's internal line drawing mode. *ONLY* column blocks ║│
│║ are supported at this time. ║│
└╨─────────────────────────────────────────────────────────────────────╨┘
*/
constant MaxColumn = 1008 // Current Maximum in TSE
integer GlobalGap = 0, // Gap between block and box
TopGap = 0,
BottomGap = 0,
LeftGap = 0,
RightGap = 0,
BoxGlobal = TRUE,
BoxTop = TRUE, // Draw Top Line? (True or false)
BoxRight = TRUE, // Draw Right Side? (T/f)
BoxLeft = TRUE, // Draw Left Side? (T/f)
BoxBottom = TRUE // Draw Bottom Line? (T/f)
/* ─────────────────────────────────────────────────────────────────── */
proc OptToggle( VAR integer opt)
opt = iif( opt, FALSE, TRUE )
return()
end OptToggle
/* ─────────────────────────────────────────────────────────────────── */
proc NumRead( VAR integer n)
string s[5] = str(n)
n = iif(Read(s), val(s), n)
return()
end NumRead
/* ─────────────────────────────────────────────────────────────────── */
string proc StrOnOff(integer i)
return (iif(i, "On", "Off"))
end StrOnOff
/* ─────────────────────────────────────────────────────────────────── */
string proc StrBoxGlobal(integer i)
string ret[3]
if i < 3
ret = StrOnOff(i)
else
ret = "Inv"
endif
return( ret )
end StrBoxGlobal
/* ─────────────────────────────────────────────────────────────────── */
proc GotoRC(integer row, integer col)
GotoLine( row )
GotoColumn( col )
end GotoRC
/* ─────────────────────────────────────────────────────────────────── */
proc VLine(integer row1, integer col1, integer row2)
integer direct = iif( row1 > row2, _UP_, _DOWN_ ) // Set Line Drawing
// Direction
GotoRC( row1, col1 ) // Goto Starting Row & Column
while row2 <> CurrLine() // Draw the line
LineDraw(direct)
endwhile
LineDraw( iif( direct == _UP_, _DOWN_, _UP_ ) ) // Make sure there is
LineDraw( iif( direct == _UP_, _DOWN_, _UP_ ) ) // a character in the
end Vline
/* ─────────────────────────────────────────────────────────────────── */
proc Hline(integer row1, integer col1, integer col2)
integer direct = iif( col1 > col2, _LEFT_, _RIGHT_ ) // Set Line Drawing
// Direction
GotoRC( row1, col1 ) // Goto Starting Row & Column
while col2 <> CurrCol() // Draw the Line
LineDraw(direct)
endwhile
LineDraw( iif( direct == _LEFT_, _RIGHT_, _LEFT_ ) ) // Make sure there is
LineDraw( iif( direct == _LEFT_, _RIGHT_, _LEFT_ ) ) // a character in the
end Hline
/* ─────────────────────────────────────────────────────────────────── */
proc SetAllGaps()
NumRead(GlobalGap) // Get Global Gap Setting
TopGap = GlobalGap // Assign Global Gap to each side
BottomGap = GlobalGap
RightGap = GlobalGap
LeftGap = GlobalGap
pushkey(<enter>) // Update the menu
end SetAllGaps
/* ─────────────────────────────────────────────────────────────────── */
menu SideOnOff()
history
"&On",,CloseBefore
"O&ff",,CloseBefore
"&Invert",,CloseBefore
end SideOnOff
/* ─────────────────────────────────────────────────────────────────── */
proc SetAllSides()
SideOnOff() // Get Global Sides On / Off
BoxGlobal = MenuOption() // Which Option was selected?
If BoxGlobal <> 3 // If invert, don't do this
BoxGlobal = iif(BoxGlobal - 2, TRUE, FALSE) // On or Off?
BoxTop = BoxGlobal // Assign value for each side
BoxBottom = BoxGlobal
BoxRight = BoxGlobal
BoxLeft = BoxGlobal
else
BoxTop = not BoxTop // Invert current values
BoxBottom = not BoxBottom
BoxRight = not BoxRight
BoxLeft = not BoxLeft
endif
pushkey(<enter>) // Update the menu
end SetAllSides
/* ─────────────────────────────────────────────────────────────────── */
proc BoxIt()
integer ULC = 0, // Upper left column of block
ULR = 0, // Upper left row of block
LRC = 0, // Lower right column of block
LRR = 0, // Lower right row of block
InsLines = 0,
Insrt = Set(Insert, On) // Turn Insert Mode on and Save
// Previous setting
set(MsgLevel, _WARNINGS_ONLY_) // Turn off display updates
if isBlockInCurrFile() <> _COLUMN_ // Is there a column block in current
message("No Column Block In File.") // buffer? If not, then return.
return()
endif
if isCursorInBlock() <> _COLUMN_ // Is the cursor in the block?
message("Cursor Not In Block.") // If not, then return.
return()
endif
PushPosition() // Store Starting Location
GotoBlockBegin()
ULC = CurrCol()
if (ULC - LeftGap <= 1) and (LeftGap >= 1) // If in first column, or left side
// is past the first column, return.
PopPosition() // Restore Starting position
message("Cannot Insert Box At or Before Beginning of Line.")
return()
endif
ULR = CurrLine()
if (ULR == 1) // If first line of file,
PushPosition() // insert enough lines to permit
Begline() // drawing the box
while InsLines < TopGap + 1
SplitLine()
InsLines = InsLines + 1
endwhile
PopPosition()
ULR = CurrLine()
endif
GotoBlockEnd()
LRC = CurrCol()
if LRC == MaxColumn // If last column of buffer, return
PopPosition() // Restore Starting position
return()
endif
LRR = CurrLine()
if BoxTop // If BoxTop == TRUE, Draw Line
Hline( (ULR - (TopGap)), (ULC - (LeftGap)), (LRC + (RightGap)))
endif
if BoxRight // If BoxRight == TRUE, Draw Line
VLine( (ULR - (TopGap)), (LRC + (RightGap)), (LRR + (BottomGap)))
endif
if BoxBottom // If BoxBottom == TRUE, Draw Line
HLine( (LRR + (BottomGap)), (LRC + (RightGap)), (ULC - (LeftGap)))
endif
if BoxLeft // If BoxLeft == TRUE, Draw Line
VLine( (LRR + (BottomGap)), (ULC - (LeftGap)), (ULR - (TopGap)))
endif
PopPosition() // Restore Starting position
UnmarkBlock() // Get rid of block
Set(Insert, Insrt) // Restore Initial Insert Value
ScrollToRow(Query(WindowRows)/2)
Return() // Exit -- ALL DONE!
end BoxIt
#include ["BoxIt.Hlp"] // Help Menus
#include ["BoxIt.Mnu"] // BoxIt Menus
#include ["BoxIt.Key"] // BoxIt Key Bindings